//
//  BSWebCell.m
//  BS
//
//  Created by lanou on 15/8/24.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "BSWebCell.h"

#import "UILabel+LJLabel.h"

#import "UIImageView+WebCache.h"

#import "Header.h"

#import "BSWebVCView.h"
@interface BSWebCell ()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UIImageView *imaView;

@end

@implementation BSWebCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(BSListModel *)model{

    _model = model;
    _titleLabel.text = _model.richtxt[@"title"];
    //自定义行间距
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:_titleLabel.text];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:5];//调整行间距
        [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [_titleLabel.text length])];
    _titleLabel.attributedText = attributedString;
    [_titleLabel sizeToFit];
    [_imaView sd_setImageWithURL:_model.richtxt[@"img_url"]];
}

- (IBAction)read:(id)sender {
    
//    NSLog(@"点击web");
    BSWebVCView *webVC = [[BSWebVCView alloc] initWithNibName:@"BSWebVCView" bundle:nil];
    webVC.htmlStr = _model.richtxt[@"source_url"];
    [self.nav pushViewController:webVC animated:YES];
    
}

@end
